package cheqex.update.controllers;

import java.util.List;

import org.apache.torque.util.Criteria;

import cheqex.dao.DailyRemarksPeer;
import cheqex.dao.DailyRemarks;
import cheqex.dao.ReportPeer;
import cheqex.dao.WeeklyRemarks;
import cheqex.dao.WeeklyRemarksPeer;

public class RemarksController {

	
	public RemarksController(){
		
	}
	
	public static String getDailyRemarks(java.sql.Date date){
		try{
			List<DailyRemarks> list = DailyRemarksPeer.retrieveRemarks(date);
			DailyRemarks remarks = list.get(0);
			return remarks.getRemarks();
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	
	public static String getWeeklyRemarks(int id){
		try{
			List<WeeklyRemarks> list = WeeklyRemarksPeer.retrieveRemarks(id);
			WeeklyRemarks remarks = list.get(0);
			return remarks.getRemarks();
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	
	public static boolean addDailyRemarks(java.sql.Date date, String remarks){
		try{
			DailyRemarksPeer.addRemarks(date, remarks);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	
	public static boolean updateDailyRemarks(java.sql.Date date, String remarks){
		try{
			DailyRemarksPeer.updateRemarks(date, remarks);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	public static boolean addWeeklyRemarks(int id, String remarks){
		try{
			WeeklyRemarksPeer.addRemarks(id, remarks);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	
	public static boolean updateWeeklyRemarks(int id, String remarks){
		try{
			WeeklyRemarksPeer.updateRemarks(id, remarks);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
}
